﻿package com.tudou.track
{
    import com.tudou.utils.*;

    public class TudouSample extends Object
    {
        protected var isSample:Boolean = false;
        static var SAMPLE_MOUNT:uint = 6000;
        static var instance:TudouSample;
        static var TOTAL_MOUNT:uint = 6000000;

        public function TudouSample()
        {
            if (instance != null)
            {
                throw new Error("It is a SINGLETON Class UserSample!");
            }
            init();
            return;
        }// end function

        public function isUTSSample() : Boolean
        {
            return isSample;
        }// end function

        protected function init() : void
        {
            isSample = MathUtil.rangeRand(1, TOTAL_MOUNT) < SAMPLE_MOUNT;
            return;
        }// end function

        public static function getInstance() : TudouSample
        {
            if (instance == null)
            {
                instance = new TudouSample;
            }
            return instance;
        }// end function

    }
}
